package main

import (
	"fmt"
	"os"
	"reflect"

	"github.com/caarlos0/env/v6"
)

type ATest struct {
	PWD  string `env:"PWD"`
	PATH A      `env:"PATH"`
}

type A struct {
	Value string
}

func ParseA(v string) (interface{}, error) {
	return A{v + ":/some/other/path"}, nil
}

func main() {
	atest := ATest{}
	pm := map[reflect.Type]env.ParserFunc{
		reflect.TypeOf(A{}): ParseA,
	}
	if err := env.ParseWithFuncs(&atest, pm); err != nil {
		fmt.Printf("Err:%+v\n", err)
		os.Exit(-1)
	}
	fmt.Printf("%+v\n", atest.PATH.Value)
}
